package com.byxy.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="_order")
public class Order implements Serializable {
	@Id
	private String id;
	private String name;
	//数量
	private String num;
	//单位
	private String unit;
	//总金额
	private float price;
	private boolean payment;
	@ManyToOne
	private Supplier supplier;
	public Order() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Order(String id, String name, String num, String unit, float price, boolean payment, Supplier supplier) {
		super();
		this.id = id;
		this.name = name;
		this.num = num;
		this.unit = unit;
		this.price = price;
		this.payment = payment;
		this.supplier = supplier;
	}
	public boolean isPayment() {
		return payment;
	}

	public void setPayment(boolean payment) {
		this.payment = payment;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getNum() {
		return num;
	}
	public void setNum(String num) {
		this.num = num;
	}
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public float getPrice() {
		return price;
	}
	public void setPrice(float price) {
		this.price = price;
	}
	public Supplier getSupplier() {
		return supplier;
	}
	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}
	@Override
	public String toString() {
		return "Order [id=" + id + ", name=" + name + ", num=" + num + ", unit=" + unit + ", price=" + price
				+ ", supplier=" + supplier + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Order other = (Order) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
}
